{% extends "base.phtml" %}


{% block content %}

<div class="box">
    <div class="box-header with-border">
        <div>
            <form id="search" method="get">
                <div class="input-apply input-apply-sm" style="width: 150px;">
                    <select class="form-control" name="campaign_id" onchange="$('#search').submit()">
                        <option value="">全部活动</option>
                        {%for k,v in campaignlist%}
                        <option value="{{v['id']}}" {{v['id'] == campaign_id ? 'selected=selected':''}}>{{v['campaign_name']}}</option>
                        {%endfor%}
                    </select>
                    &nbsp;
                    <select class="form-control" name="status" onchange="$('#search').submit()">
                        <option value="0" {{status == 0 ? 'selected=selected':''}}>待提现</option>
                        <option value="1" {{status == 1 ? 'selected=selected':''}}>已提现</option>
                    </select>
                    &nbsp;
                    <a href="javascript:void(0)" onclick="exportXLS()" class="btn btn-primary btn-sm" style="display: {{status == 1 ? 'block':'none'}}">导出数据</a>
                </div>
            </form>
        </div>
    </div>
    <div class="box-body">
        <table class="table table-bordered  table-hover">
            <tr>
                <th>商品</th>
                <th>用户</th>
                <th>支付金额</th>
                <th>提现金额</th>
                <th>状态</th>
                <th>审核人员</th>
                <th style="width: 150px">操作</th>
            </tr>

            {%for k,v in list%}
            <tr>
                <td>{{v.goodsname}}</td>
                <td>{{v.nickname}}</td>
                <td>{{v.pay_money}}</td>
                <td>{{v.apply_money}}</td>
                <td>{{v.status==1?'已提现':'待提现'}}</td>
                <td>{{v.edituser}}</td>
                <td>
                    {% if status == 0 %}
                    <a data-url="sendapply?id={{v.id}}" class="btn btn-danger pull-right delete">发放提现</a>
                    {% endif %}
                </td>
            </tr>
            {%endfor%}
        </table>
    </div>

    <div class="box-footer clearfix">
        {{pageHtml}}
    </div>
</div>
<script>
    function exportXLS(){
        var campaign_id = $("select[name='campaign_id']").val();
        window.location.href = "/acp/apply/export?campaign_id=" + campaign_id;
    }
</script>
{% endblock %}